package com.wangjw.dataStructure.tree;

import java.util.ArrayList;
import java.util.Random;

/**
 * Created by wangjw on 18/5/15.
 */
public class BSTTester {

    public static void main(String[] args) {
        BST<Integer> bst = new BST<>();

        int n = 1000;
        Random random = new Random();
        for (int i = 0; i < n; i++) {
            bst.add(random.nextInt(10000));
        }
        System.out.println("bst size = " + bst.size());

        ArrayList<Integer> nums = new ArrayList<>();
        while (!bst.isEmpty()) {
            nums.add(bst.removeMax());
        }
        System.out.println("nums size = " + nums.size());
        System.out.println(nums);

        for (int i = 1; i < nums.size(); i++) {
            if (nums.get(i - 1) < nums.get(i)) {
                throw new IllegalArgumentException("Error");
            }
        }
        System.out.println("removeMax test completed.");
    }
}
